package com.smart.manage.service.impl;

import java.util.List;
import com.smart.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.manage.mapper.DrugMovementsMapper;
import com.smart.manage.domain.DrugMovements;
import com.smart.manage.service.IDrugMovementsService;

/**
 * 药品变动明细Service业务层处理
 * 
 * @author lingyao
 * @date 2025-03-07
 */
@Service
public class DrugMovementsServiceImpl implements IDrugMovementsService 
{
    @Autowired
    private DrugMovementsMapper drugMovementsMapper;

    /**
     * 查询药品变动明细
     * 
     * @param movementId 药品变动明细主键
     * @return 药品变动明细
     */
    @Override
    public DrugMovements selectDrugMovementsByMovementId(Long movementId)
    {
        return drugMovementsMapper.selectDrugMovementsByMovementId(movementId);
    }

    /**
     * 查询药品变动明细列表
     * 
     * @param drugMovements 药品变动明细
     * @return 药品变动明细
     */
    @Override
    public List<DrugMovements> selectDrugMovementsList(DrugMovements drugMovements)
    {
        return drugMovementsMapper.selectDrugMovementsList(drugMovements);
    }

    /**
     * 新增药品变动明细
     * 
     * @param drugMovements 药品变动明细
     * @return 结果
     */
    @Override
    public int insertDrugMovements(DrugMovements drugMovements)
    {
        drugMovements.setCreateTime(DateUtils.getNowDate());
        return drugMovementsMapper.insertDrugMovements(drugMovements);
    }

    /**
     * 修改药品变动明细
     * 
     * @param drugMovements 药品变动明细
     * @return 结果
     */
    @Override
    public int updateDrugMovements(DrugMovements drugMovements)
    {
        drugMovements.setUpdateTime(DateUtils.getNowDate());
        return drugMovementsMapper.updateDrugMovements(drugMovements);
    }

    /**
     * 批量删除药品变动明细
     * 
     * @param movementIds 需要删除的药品变动明细主键
     * @return 结果
     */
    @Override
    public int deleteDrugMovementsByMovementIds(Long[] movementIds)
    {
        return drugMovementsMapper.deleteDrugMovementsByMovementIds(movementIds);
    }

    /**
     * 删除药品变动明细信息
     * 
     * @param movementId 药品变动明细主键
     * @return 结果
     */
    @Override
    public int deleteDrugMovementsByMovementId(Long movementId)
    {
        return drugMovementsMapper.deleteDrugMovementsByMovementId(movementId);
    }
}
